{extend name="public/base"}

{block name="title"}
实名认证
{/block}

{block name="style"}
{css href="/static/wechat/css/index.css" /}
{css href="/static/wechat/css/certification.css" /}
<style type="">
    .scsfz{height:7rem}
    .scsfz>i{height:70%;}
    .g-scsfz-div p{font-size:0.7rem;line-height:1rem;height:2rem;}
</style>
{/block}

{block name="body"}
<div class="pageControl editMsg">
    <div class="msui_nav msui_navTop">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">修改认证信息</h1>
    </div>
    <div class="weui-top">
        <form action="?" id="certification_form">
            <div class="weui-cells weui-cells_form">
                <div class="msui_cells-title fs075 cl-6666">身份信息</div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" name="proposer" placeholder="请输入您身份证上的姓名" value="{$data.proposer|default=''}" />
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">身份证号</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" name="card_no" placeholder="请输入您身份证号" value="{$data.card_no_all|default=''}" />
                    </div>
                </div>
                <div class="msui_cells-title fs075 cl-6666">身份证照片</div>
                <!--上传身份证照片-->
                <div class="g-scsfz-div">
                    <div class="scsfz">
                        <i class="sczmsfz" {notempty name='data.id_card_in_hand'}style="background-image:url({$data.id_card_in_hand});"{/notempty}>
                        <div class="weui-uploader__input-box scsfz3">
                            <input id="uploaderInput1" class="weui-uploader__input" type="file" accept="image/*"  file-attr="" />
                            <input type="hidden" name="id_card_in_hand" value="{$data.id_card_in_hand|default=''}" />
                        </div>
                        </i>
                        <p>手持身份证正面照片</p>
                    </div>

                    <div class="scsfz">
                        <i class="zmsfz" {notempty name='data.id_card_front'}style="background-image:url({$data.id_card_front});"{/notempty}>
                        <div class="weui-uploader__input-box scsfz3">
                            <input id="uploaderInput2" class="weui-uploader__input" type="file" accept="image/*" file-attr="" />
                            <input type="hidden" name="id_card_front" value="{$data.id_card_front|default=''}" />
                        </div>
                        </i>
                        <p>身份证正面照片</p>
                    </div>

                    <div class="scsfz">
                        <i class="sfzfm" {notempty name='data.id_card_verso'}style="background-image:url({$data.id_card_verso});"{/notempty}>
                        <div class="weui-uploader__input-box scsfz3">
                            <input id="uploaderInput3" class="weui-uploader__input" type="file" accept="image/*" file-attr="" />
                            <input type="hidden" name="id_card_verso" value="{$data.id_card_verso|default=''}" />
                        </div>
                        </i>
                        <p>身份证反面照片</p>
                    </div>
                </div>
                <input type="hidden" name="type" value="{$type}" />
                <div class="msui_button">
                    <div class="msui_button-bd">
                        <a href="javascript:;" class="msui_button-content background{$type}">提交审核</a>
                    </div>
                </div>
            </div>
        </form>
    </div>

</div>
<div id="loadingToast" style="display:none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast" style="opacity: 1; visibility: visible;">
        <i class="weui-loading weui-icon_toast"></i>
        <p class="weui-toast__content">正在提交...</p>
    </div>
</div>
{/block}

{block name="javascript"}
<script>
    $(function () {
        //  提交申请
        $(".msui_button-content").click(function (e) {
            $('#loadingToast').fadeIn(100);
            $('.weui-toast__content').html('正在提交...');
            e.preventDefault();
            var _form = $("#certification_form");
            $.ajax({
                type : 'POST',
                url : _form.attr('action'),
                data : _form.serialize(),
                dataType : 'json',
                success : function (msg) {
                    $('#loadingToast').fadeOut(100);
                    if (msg.code == 200) {
                        alert('保存成功!');
                        window.location.href = "/wechat/w_member_role_info/save_role_info/type/" + $("input[name='type']").val();
                    } else {
                        var code = msg.code;
                        $.alert(error_code[code]);
                    }
                }
            });
        });

        $("input[type='file']").change(function () {
            upload_id_card($(this));
        });
    });

</script>
{/block}